#!/bin/bash

. tools.sh

while :
do
    rm -f *.WARNING* *.INFO*
    startProcessBackend ../bin/PingPongClient_test 127.0.0.1 10035 4 1000 30 100

    startNum=`rand 0 5`
    for ((i = 0; i < $startNum; i++));
    do
        startProcessBackend ../bin/PingPongServer_test 10035 0 4
        pid=`findPid PingPongServer_test`
        sleepTime=`rand 5 10`
        sleep $sleepTime
        kill -9 $pid
        sleep 1s
    done

    waitProcessClose PingPongClient
done

